package cn.tj212.xiaoyin.core.user.service.impl;

import cn.tj212.xiaoyin.common.page.TailPage;
import cn.tj212.xiaoyin.core.user.dao.UserCourseSectionDao;
import cn.tj212.xiaoyin.core.user.domain.UserCourseSection;
import cn.tj212.xiaoyin.core.user.domain.UserCourseSectionDto;
import cn.tj212.xiaoyin.core.user.service.IUserCourseSectionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserCourseSectionServiceImpl implements IUserCourseSectionService {

    @Autowired
    private UserCourseSectionDao entityDao;

    @Override
    public UserCourseSection getById(Long id) {
        return entityDao.getById(id);
    }

    @Override
    public List<UserCourseSection> queryAll(UserCourseSection queryEntity) {
        return entityDao.queryAll(queryEntity);
    }

    @Override
    public UserCourseSection queryLatest(UserCourseSection queryEntity) {
        return entityDao.queryLatest(queryEntity);
    }

    @Override
    public TailPage<UserCourseSectionDto> queryPage(UserCourseSection queryEntity, TailPage<UserCourseSectionDto> page) {
        Integer itemsTotalCount=entityDao.getTotalItemsCount(queryEntity);
        List<UserCourseSectionDto> items=entityDao.queryPage(queryEntity,page);
        page.setItemsTotalCount(itemsTotalCount);
        page.setItems(items);
        return page;
    }

    @Override
    public void createSelectivity(UserCourseSection entity) {
        entityDao.createSelectivity(entity);
    }

    @Override
    public void update(UserCourseSection entity) {
        entityDao.update(entity);
    }

    @Override
    public void updateSelectivity(UserCourseSection entity) {
        entityDao.updateSelectivity(entity);
    }

    @Override
    public void delete(UserCourseSection entity) {
        entityDao.delete(entity);
    }

    @Override
    public void deleteLogic(UserCourseSection entity) {
        entityDao.deleteLogic(entity);
    }
}
